package com.zmx.patientend.view.activity;

import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;


import com.zmx.patientend.BaseActivity;
import com.zmx.patientend.R;
import com.zmx.patientend.adapter.CheckDiseaseLeftAdapter;
import com.zmx.patientend.adapter.CheckDiseaseRightAdapter;

import java.util.ArrayList;
import java.util.List;

import butterknife.BindView;
import butterknife.ButterKnife;

/**
 * 时间：2020/5/4 10:54
 * 功能：查疾病
 */
public class CheckDiseaseActivity extends BaseActivity {


    @Override
    protected int getLayoutId() {
        return R.layout.activity_check_disease;
    }

    @Override
    protected void initViews() {

        setToolbar(R.id.tool_bar);
        WebView webView = findViewById(R.id.webview);
        //声明WebSettings子类
        WebSettings webSettings = webView.getSettings();

//如果访问的页面中要与Javascript交互，则webview必须设置支持Javascript
        webSettings.setJavaScriptEnabled(true);

//设置自适应屏幕，两者合用
        webSettings.setUseWideViewPort(true); //将图片调整到适合webview的大小
        webSettings.setLoadWithOverviewMode(true); // 缩放至屏幕的大小

//缩放操作
        webSettings.setSupportZoom(true); //支持缩放，默认为true。是下面那个的前提。
        webSettings.setBuiltInZoomControls(true); //设置内置的缩放控件。若为false，则该WebView不可缩放
        webSettings.setDisplayZoomControls(false); //隐藏原生的缩放控件

//其他细节操作
        webSettings.setCacheMode(WebSettings.LOAD_CACHE_ELSE_NETWORK); //关闭webview中缓存
        webSettings.setAllowFileAccess(true); //设置可以访问文件
        webSettings.setJavaScriptCanOpenWindowsAutomatically(true); //支持通过JS打开新窗口
        webSettings.setLoadsImagesAutomatically(true); //支持自动加载图片
        webSettings.setDefaultTextEncodingName("utf-8");//设置编码格式
        webView.loadUrl("https://jb.9939.com/");
        webView.setWebViewClient(new WebViewClient(){
            @Override
            public boolean shouldOverrideUrlLoading(WebView view, String url) {
                view.loadUrl(url);
                return true;
            }
        });

    }
//    @BindView(R.id.check_left_re)
//    RecyclerView checkLeftRe;
//    @BindView(R.id.check_right_re)
//    RecyclerView checkRightRe;
//
//    private CheckDiseaseLeftAdapter adapter;
//    private CheckDiseaseRightAdapter rightAdapter;
//
//    @Override
//    protected int getLayoutId() {
//        return R.layout.activity_check_disease;
//    }
//
//    @Override
//    protected void initViews() {
//        ButterKnife.bind(this);
//        setToolbar(R.id.tool_bar);
//
//        checkLeftRe.setLayoutManager(new LinearLayoutManager(this));
//        adapter = new CheckDiseaseLeftAdapter(this);
//        checkLeftRe.setAdapter(adapter);
//
//        checkRightRe.setLayoutManager(new LinearLayoutManager(this));
//        rightAdapter = new CheckDiseaseRightAdapter(this);
//        checkRightRe.setAdapter(rightAdapter);
//
////        List<String> ls = new ArrayList<>();
////        List<String> right_ls = new ArrayList<>();
////        right_ls.add("头部");
////        ls.add("头部");
////        ls.add("上半身");
////        ls.add("四肢");
////        ls.add("中间");
////        ls.add("全身");
////        ls.add("皮肤");
////        rightAdapter.setListAndNotifyDataSetChanged(right_ls);//就是设置list然后刷新
////        adapter.setListAndNotifyDataSetChanged(ls);//就是设置list然后刷新
////        adapter.setOnItemClickListener(new OnItemClickListener() {
////            @Override
////            protected void onItemClick(View view, int listPosition) {
////
////
////                Log.e("设置右边数据","设置右边数据");
////                adapter.mCheckedPosition = listPosition;
////                adapter.notifyDataSetChanged();
////                right_ls.clear();
////                right_ls.add(ls.get(listPosition));
////                rightAdapter.setListAndNotifyDataSetChanged(right_ls);//就是设置list然后刷新
////
////            }
////        });
//    }

}
